<?php 
session_start();
if (isset($_POST['name']) && isset($_POST['fdes'])){
    $openid=trim(addslashes($_POST['fdes']));
	$name=trim(addslashes($_POST['name']));
	$phone=trim(addslashes($_POST['phone']));
	$email=trim(addslashes($_POST['email']));
	$hao=trim(addslashes($_POST['hao']));
	$nianji=trim(addslashes($_POST['nianji']));
	$szqu=trim(addslashes($_POST['szqu']));
	$fxqu=trim(addslashes($_POST['fxqu']));
	$school=trim(addslashes($_POST['school']));
	$school2=trim(addslashes($_POST['school2']));

	if (empty($name) || empty($phone) || empty($fxqu) || empty($hao)){
	    echo json_encode(array('s'=>'not'));
	    exit;
	}
	include_once("../c/config.php");
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	$sql="select id from u3 where openid='".$openid."'  limit 0, 1";
	$query=$mysqli->query($sql);
    if($query->num_rows>0){
       
    }else{
        $sql="select id from u4 where openid='".$openid."'  limit 0, 1";
        $query=$mysqli->query($sql);
        if($query->num_rows>0){
            
        }else{
            $mysqli->query("INSERT INTO `u4` (`openid`, `name`, `phone`,`email`, `hao`,`nianji`,`szqu`,`fxqu`,`school`,`school2`, `createtime`) VALUES ('".$openid."','".$name."','".$phone."','".$email."','".$hao."','".$nianji."','".$szqu."','".$fxqu."','".$school."','".$school2."','".date("Y-m-d H:i:s")."') ");
            
        }
    }
    
    
    $mysqli->close();
	
    echo json_encode(array('s'=>'ok'));
}else{
    echo json_encode(array('s'=>'not'));
}
?>